package top.lyc829.mymusic.ui.fragment.search

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import top.lyc829.mymusic.base.BaseViewModel
import top.lyc829.mymusic.ext.launch
import top.lyc829.mymusic.model.bean.Search
import top.lyc829.mymusic.model.db.MyDataBase
import top.lyc829.mymusic.model.http.MyNetwork
import top.lyc829.mymusic.model.repository.IndexRepository

class SearchViewModel : BaseViewModel() {
    private var repository : IndexRepository =
        IndexRepository.getInstance(MyDataBase.instance.getBannerDao(), MyNetwork.getInstance())

    private var _searchList = MutableLiveData<Search>()
    val searchList : LiveData<Search> get() = _searchList

    fun getSearchList() {
        launch {
            val searchs = repository.search(" 林俊杰")
            _searchList.value = searchs
        }
    }
}